from utils.operators.cluster_for_spark_sql_operator import SparkSqlOperator
from datetime import timedelta
from jms_hi.ods.tab.tab_outlets_abnormal_config_hi import jms_ods__tab_outlets_abnormal_config_hi

jms_dim__dim_tab_outlets_abnormal_config_base_hi = SparkSqlOperator(
    task_id='jms_dim__dim_tab_outlets_abnormal_config_base_hi',
    task_concurrency=1,
    pool_slots=1,
    master='yarn',
    name='jms_dim__dim_tab_outlets_abnormal_config_base_hi_{{ execution_date | date_add(1) | cst_ds }}',
    sql='jms_hi/dim/dim_tab_outlets_abnormal_config_base_hi/execute.sql',
    executor_cores=2 , 
    executor_memory='2G' , 
    email=['payne.jiang@jtexpress.com', 'yl_bigdata@yl-scm.com'],
    num_executors=2 , 
    conf={'spark.dynamicAllocation.enabled': 'true',  # 动态资源开启
          'spark.shuffle.service.enabled': 'true',  # 动态资源 Shuffle 服务开启
        'spark.dynamicAllocation.maxExecutors'             : 2 , 
          'spark.dynamicAllocation.cachedExecutorIdleTimeout': 60,  # 动态资源自动释放闲置 Executor 的超时时间(s)
          'spark.sql.sources.partitionOverwriteMode': 'dynamic',  # 允许删改已存在的分区
        'spark.executor.memoryOverhead'             : '1G' , 
          'spark.sql.shuffle.partitions': 10,
          },
    yarn_queue='pro',
    execution_timeout=timedelta(minutes=10),
)
jms_dim__dim_tab_outlets_abnormal_config_base_hi<< jms_ods__tab_outlets_abnormal_config_hi